package com.bdqn.xu.controller;

import com.bdqn.xu.pojo.ReplyDetail;
import com.bdqn.xu.service.Reply_detailService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/reply")
public class Reply_detailController {
    @Resource
    private Reply_detailService reply_detailService;

    @RequestMapping("/view/{id}")
    public String huifu(@PathVariable int id, Model model){
        ReplyDetail list = reply_detailService.getreplybyid(id);
        model.addAttribute("list",list);
//        request.setAttribute("invid",id);
        System.out.println(id);
        return "info";
    }
    @RequestMapping("/addre/{invid}")
    public String addre(@PathVariable int invid, HttpServletRequest request){
        request.setAttribute("invid",invid);
        System.out.println(invid);
        return "addreyly";
    }
    @RequestMapping("/save")
    public String addRe(ReplyDetail replyDetail){
        System.out.println(replyDetail);

        reply_detailService.addReply(replyDetail);

            return "info";

    }
}
